﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public class MineFiled
{
    public float AllDensity = 1;
    public Dictionary<Item.ItemsType, float> ProductionList = new Dictionary<Item.ItemsType, float>();
    public string Name="NONE";
    public string Description = "NONE";
    public string m_SceneName;
    public int m_EntranceTicketPrice = 500;
    public MineFiled()
    {
        ProductionList.Clear();
        ProductionList.Add(Item.ItemsType.MATERIAL_ORE_FE, 0.2f);
        ProductionList.Add(Item.ItemsType.MATERIAL_ORE_AG, 0.1f);
    }
    public Item Dig()
    {

        foreach( var item in ProductionList)
        {
            float randomValue = UnityEngine.Random.Range(0f, 100f);
            if(randomValue < item.Value)
            {
                var itemInstance = ItemFactory.Instance.createItem(item.Key.ToString());
                if(itemInstance != null)
                {
                    MessageShow.Instance.Messaage("挖到\"" + itemInstance.Name + "\"了");
                    return itemInstance;
                }
            }
        }
        return null;
    }
}